#include <iostream>
using std::cout;
using std::endl;
using std::ostream;

//一般来说编译器会从上到下进行扫描
//在类中会扫描完全部内容再进行编译
//
//一般情况会把内部类定义在外部类的private区域
class Line{
/* public: */
    class Point{
    public:
        Point(int ix ,int iy = 0)
            : _ix(ix)
              , _iy(iy)
        {
            cout << "Point(int=0,int=0)" << endl;
        }

        Point(){
            cout << "Point()" << endl;
        }

        ~Point(){cout << "~Point()" << endl;}
        friend ostream & operator<<(ostream & os,const Line::Point & rhs);
    private:
        int _ix;
        int _iy;
    };
public:
    Line(){}

    Line(int x1,int y1,int x2,int y2)
    : _pt1(x1,y1)
    , _pt2(x2,y2)
    {}
    friend ostream & operator<<(ostream & os,const Point & rhs);
    friend ostream & operator<<(ostream & os,const Line & rhs);
private:
    Point _pt1;
    Point _pt2;
    /* double z; */
};

ostream & operator<<(ostream & os,const Line::Point & rhs){
    os << "(" << rhs._ix << "," << rhs._iy << ")";
    return os;
}

ostream & operator<<(ostream & os,const Line & rhs){
    os << rhs._pt1 << "---->" << rhs._pt2 ;
    return os;
}

void test0(){
    /* Line l(1,2,3,4); */
    /* Line l2; */
    /* cout << sizeof(Line) << endl; */
}

void test1(){
    /* Line::Point pt(1,2); */
    /* cout << "pt:" << pt << endl; */
}

void test2(){
    Line l(1,2,3,4);
    /* cout << l._pt1 << endl; */
    cout << l << endl;
}

int main(void){
    /* test0(); */
    /* test1(); */
    test2();
    return 0;
}
